﻿using QMERP.SeedWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QMERP.Domain.Entities
{
    /// <summary>
    /// 合约
    /// </summary>
    public class Contract : FullEntity<long>
    {
        public Contract()
        {
            Contract_Customers = new HashSet<Contract_Customer>();
            Contract_Lenses = new HashSet<Contract_Lens>();
            Contract_Lens_SalesProcessConstraints = new HashSet<Contract_Lens_SalesProcessConstraint>();
            RetailOrders = new HashSet<RetailOrder>();
            BulkOrders = new HashSet<BulkOrder>();
        }
        /// <summary>
        /// 合约编号
        /// </summary>
        public string Number { get; set; } = "";
        /// <summary>
        /// 合约名称
        /// </summary>
        public string Name { get; set; } = "";
        /// <summary>
        /// 合约类型
        /// </summary>
        public string Type { get; set; } = "";
        /// <summary>
        /// 总金额
        /// </summary>
        public decimal Money { get; set; }
        /// <summary>
        /// 预付金额
        /// </summary>
        public decimal PrepaidMoney { get; set; }
        /// <summary>
        /// 收款期数
        /// </summary>
        public int Period { get; set; }
        /// <summary>
        /// 合约状态
        /// </summary>
        public string Status { get; set; } = "";
        /// <summary>
        /// 合约开始时间
        /// </summary>
        public DateTime BeginOn { get; set; } = DateTime.Now;
        /// <summary>
        /// 合约结束时间
        /// </summary>
        public DateTime EndOn { get; set; } = DateTime.MaxValue;
        /// <summary>
        /// 审核人Id
        /// </summary>
        public long? CheckedBy { get; set; }
        /// <summary>
        /// 审核人名称
        /// </summary>
        public string? CheckedByName { get; set; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? CheckedOn { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 合约绑定的客户列表
        /// </summary>
        public virtual ICollection<Contract_Customer> Contract_Customers { get; set; }
        /// <summary>
        /// 合约镜种列表
        /// </summary>
        public virtual ICollection<Contract_Lens> Contract_Lenses { get; set; }
        /// <summary>
        /// 合约镜种约束列表
        /// </summary>
        public virtual ICollection<Contract_Lens_SalesProcessConstraint> Contract_Lens_SalesProcessConstraints { get; set; }
        /// <summary>
        /// 散镜订单列表
        /// </summary>
        public virtual ICollection<RetailOrder> RetailOrders { get; set; }
        /// <summary>
        /// 散镜订单列表
        /// </summary>
        public virtual ICollection<BulkOrder> BulkOrders { get; set; }
    }
}
